import request from './request'
import qs from 'qs'

// 发送注册短信验证码
export const getCodeApi = (params) => request.post('/sendSMS', qs.stringify(params))
// 手机号验证码登录(含注册)
export const LoginApi = (params) => request.post('/phoneRegin', qs.stringify(params))
// 微信扫码登录 /wechatUsers/PCLogin
export const WeixinLonginApi = (params) => request.post('/wechatUsers/PCLogin', qs.stringify(params))
// 手机绑定微信 /wechatUsers/binding
export const BindWeixinApi = (params) => request.post('/wechatUsers/binding', qs.stringify(params))
// 获取用户信息
export const UserInfoApi = () => request.get('/shop/userProfiles')
// 精品推荐接口
export const JingPinApi = () => request.get('/products/recommend')
// 热门兑换接口
export const HotApi = () => request.get('/products/hot')
// 商品详情接口 /products/{id}
export const GoodsDetilesApi = (params) => request.get(`/products/${params.id}`)
// 商品搜索（含首页的“更多”）/products
export const MoreApi = (params) => request.get('/products', { params })
// 加入到购物车 /shop/carts/add
export const JionCartApi = (params) => request.post('/shop/carts/add', qs.stringify(params))
// 查看购物车 /shop/carts
export const GoodsDataApi = () => request.get('/shop/carts')
// 购物车删除商品 /shop/carts?productIds={id}
export const GoodsDelApi = (params) => request.delete(`/shop/carts?productIds=${params.id}`)